home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
news
/
inn1.000
/
inn1.4sec-linux-src.tar
/
inn
/
iftrue.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1993-01-29
|
552b
|
25 lines
#! /bin/sh
## $Revision: 1.3 $
## Perform a test(1) and execute a command string if the test is true;
## otherwise exit 0. Usage:
## testit <test> <command>
## On some systems (those with a /bin/sh from BSD4.2), the following
## line in a Makefile will always fail:
## if [ ! -f x ] ; then echo No x -- stop. ; exit 1 ; else exit 0 ; fi
case $# in
2)
;;
*)
echo "Can't perform test: wrong number of arguments." 1>&2
exit 1
;;
esac
TEST="$1"
COMMAND="$2"
if eval "test ${TEST}" ; then
eval "${COMMAND}"
exit $?
fi
exit 0